package com.oncecloud.devops.service.sample.core;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Map;

import com.oncecloud.devops.service.sample.bean.Result;
import com.oncecloud.devops.service.sample.common.CiHost;
import com.oncecloud.devops.service.sample.common.GitLab;
import com.oncecloud.devops.service.sample.common.JenkinsItem;

public interface CiCore {
	/**
	 * 获取项目
	 * @param gitLabProject
	 * @param private_token
	 * @return
	 */
	public Result getGitProjects(GitLab gitLab,String private_token);
	/**
	 * 获取单个项目
	 * @param projectId
	 * @param private_token
	 * @return
	 */
	public Result getGitSingleProject(GitLab gitLab,String private_token);
	/**
	 * 获取项目分支
	 * @param projectId
	 * @param private_token
	 * @return
	 */
	public Result getGitProjectBranches(GitLab gitLab,String private_token);
	/**
	 * 获取项目分支
	 * @param projectId
	 * @param private_token
	 * @param branch_name
	 * @return
	 */
	public Result getGitProjectSingleBranch(GitLab gitLab,String private_token,String branch_name);
	/**
	 * 获取项目的触发机制
	 * @param projectId
	 * @param private_token
	 * @return
	 */
	public Result getGitProjectHooks(GitLab gitLab,String private_token);
	/**
	 * 获取项目触发机制
	 * @param projectId
	 * @param private_token
	 * @param hookId
	 * @return
	 */
	public Result getGitProjectSingleHook(GitLab gitLab,String private_token,String hookId);
	/**
	 * 创建项目触发机制
	 * @param private_token
	 * @param url
	 * @param events
	 * @return
	 */
	public Result createGitProjectHook(GitLab gitLab,String private_token,String hookUrl,Map<String,Boolean> events);
	/**
	 * 删除项目触发机制
	 * @param private_token
	 * @return
	 */
	public Result deleteGitProjectHook(GitLab gitLab,String private_token);
	/**
	 * 下载源码
	 * @param sourcePath源码下载位置
	 * @param branch指定分支
	 * @param gitAddress地址
	 * @return
	 */
	public Result gitClone(CiHost ciHost,String sourcePath,String branch,String gitAddress);
	/**
	 * 源码扫描
	 * @param ciHost
	 * @param sourcePath
	 * @return
	 */
	public Result sonarSourceScanner(CiHost ciHost,String sourcePath);
	/**
	 * 单元测试
	 * @param sourcePath源码地址
	 * @return
	 */
	public Result mavenUnitTest(CiHost ciHost,String sourcePath);
	/**
	 * 源码编译打包
	 * @param ciHost
	 * @param sourcePath
	 * @return
	 */
	public Result mavenSourcePackage(CiHost ciHost,String sourcePath);
	/**
	 * 创建一个jenkins　job
	 * @param jenkinsItem
	 * @return
	 */
	public Result createJenkinsProject(JenkinsItem jenkinsItem) throws URISyntaxException, IOException ;
}
